// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import locale from 'element-ui/lib/locale/lang/en'
import App from './App'
import router from './router'
// import loading from './js/loading.js' // 引入loading
// import './assets/css/reset.css';

import globalMixins from "./mixins/globalMixins";
Vue.mixin(globalMixins);

// 加载公共样式
import '../static/css/common.css'
import '../static/css/ele_common.css'

/**
 * @desc 自适应宽度
 * @param {number} designWidth 设计稿宽带 默认 1920
 * @param {number} maxWidth 最大宽度，缩大到一定程度不在缩大 默认 无限制
 * @param {number} minWidth 最小宽度，缩小到一定程度不在缩小 默认 1366
 * @param {number} base 基准值 默认 100(100px === 1rem)
 */
 (({ designWidth = 1920, maxWidth = 2 ** 64, minWidth = 1366, base = 100 }) => {
  autoComputed();
  window.addEventListener('resize', autoComputed);
  function autoComputed() {
    const html = document.documentElement || document.body;
    const limitMax = maxWidth / designWidth;
    const limitMin = minWidth / designWidth;
    const scale = document.body.offsetWidth / designWidth;

    html.style.fontSize =
      (
        (scale < limitMin ? limitMin : scale > limitMax ? limitMax : scale) *
        base
      ).toFixed(2) + 'px';
  }
})({ minWidth: 1440 });


Vue.config.productionTip = false

// Vue.use(ElementUI);
Vue.use(ElementUI, { locale })
// Vue.use(loading) // 全局使用loading
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
